/*
 * Copyright 2021-2022 the original author(https://github.com/wj596)
 * 
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * </p>
 */
package org.jsets.fastboot.security.config;

import java.util.LinkedList;
import java.util.List;
import org.springframework.boot.context.properties.ConfigurationProperties;
import lombok.Data;

/**
 * 属性
 *
 * @Author wangjie
 * @date 2021.07.04 23:26
 */
@Data
@ConfigurationProperties(prefix = Constants.PREFIX, ignoreUnknownFields = true, ignoreInvalidFields = true)
public class SecurityProperties {
	
	private String subsystemName;// 系统名称
	private boolean enabled;// 是否开启鉴权
	private boolean remote;// 是否是远程鉴权
	private boolean corsEnabled;// 是否允许跨域
	private boolean captchaEnabled;// 是否启用验证码
	private boolean annotationEnabled;// 启用注解鉴权
	private boolean refreshTokenEnabled;// 启用刷新令牌
	private boolean singleOnlineEnabled;// 单一用户登陆
	private String tokenSignKey;// 令牌签名秘钥
	private String hmacSignKey;// HMAC签名秘钥
	private String aesSecretKey;// AES秘钥
	private Long hmacSignTimeout = Constants.HMAC_SIGN_TIMEOUT;// HMAC签名有效期
	private String hmacSignSalt;// HMAC签名盐
	private String tokenCacheName = Constants.TOKEN_CACHE_NAME;// 会话缓存名称
	private String passwdRetryTimesCacheName = Constants.PASSWD_RETRY_TIMES_CACHE_NAME;// 密码重试记录缓存名称
	private Long passwdRetryTimesCacheTimeout = Constants.PASSWD_RETRY_TIMES_CACHE_TIMEOUT;// 密码重试记录缓存超时间,单位秒
	private String invalidRefreshTokenCacheName = Constants.INVALID_REFRESH_TOKEN_CACHE_NAME;
	private Long invalidRefreshTokenCacheTimeout = Constants.INVALID_REFRESH_TOKEN_CACHE_TIMEOUT;
	private String userOnlineCacheName = Constants.USER_ONLINE_CACHE_NAME;
	private String captchaCacheName = Constants.CAPTCHA_CACHE_NAME;// 验证码缓存名称
	private Long captchaCacheTimeout = Constants.CAPTCHA_CACHE_TIMEOUT;// 验证码缓存名称
	private Integer passwordRetryMaximum;// 密码最大重试次数
	private Long tokenExpiration = Constants.TOKEN_EXPIRATION;// 会话有效期,单位秒
	private Integer rememberMeTimeout = Constants.REMEMBER_ME_TIMEOUT;// 记住我时间,单位秒
	private String passwordEncodeAlgorithm = Constants.PASSWORD_ENCODE_ALGORITHM_SHA256;// 密码编码算法
	private List<String> authIgnorings;// 忽略验证的地址
	private List<String> authRules = new LinkedList<String>();// 过滤规则
	
	
	//#################提示信息#################
	private String usernameBlankTips = Constants.USERNAME_BLANK_TIPS;// 账号为空提示
	private String passwordBlankTips = Constants.PASSWD_BLANK_TIPS;// 密码为空提示
	private String captchaKeyBlankTips = Constants.CAPTCHA_KEY_BLANK_TIPS;// 验证码KEY为空提示
	private String captchaBlankTips = Constants.CAPTCHA_BLANK_TIPS;// 验证码为空提示
	private String captchaTimeoutTips = Constants.CAPTCHA_TIMEOUT_TIPS;// 验证码过期提示
	private String usernameLockedTips = Constants.USERNAME_LOCKED_TIPS;
	private String accessDeniedTips = Constants.ACCESS_DENIED_TIPS;
	private String usernameOrPasswdErrorTips = Constants.USERNAME_OR_PASSWD_ERROR_TIPS;// 账号或密码错误提示
	private String tokenBlankTips = Constants.TOKEN_BLANK_TIPS;// 令牌为空提示
	private String tokenExpiredTips = Constants.TOKEN_EXPIRED_TIPS;// 令牌失效提示
	private String tokenInvalidTips = Constants.TOKEN_INVALID_TIPS;// 令牌无效提示
	private String captchaInvalidTips = Constants.CAPTCHA_INVALID_TIPS;// 验证码错误提示
	private String loginSucceedTips = Constants.LOGIN_SUCCEED_TIPS;// 登陆成功提示
	private String loginErrorTips = Constants.LOGIN_ERROR_TIPS;// 登陆失败提示
	private String logoutSucceedTips = Constants.LOGOUT_SUCCEED_TIPS;// 登出成功提示
	private String forbiddenTips = Constants.FORBIDDEN_TIPS;// 权限不足提示
	private String unauthorizedTips = Constants.UNAUTHORIZED_TIPS;// 未认证提示
	private String hmacInvalidTips = Constants.HMAC_INVALID_TIPS;// hmac签名验证失败
	private String onlineUserExtrudeTips = Constants.ONLINE_USER_EXTRUDE_TIPS;// 在线用户被挤出提示
	private Integer insufficientAuthenticationCode = 401001;// 权限不足业务编码
}